// 给接口定义的类型赋值时候
// 直接赋值,为了进行类型推导会进行严格的类型限制,不能多出接口中定义的属性也不能少接口中定义的属性
//将变量标识符复制给其他变量时,会进行多出接口定义的属性方法自动去除,不会报错,称为freshness擦除操作

interface IPerson {
    name: string,
    eating: () => void
}
//直接赋值
const p2: IPerson = {
    name: "john",
    // age: 18, 多余的属性会报错
    eating() {
        console.log(this.name+" is eating");
    }
}
p2.eating() //john is eating
//变量标识符赋值
interface IPerson{
    name: string,
    eating: ()=>void
}
const obj = {
    name:"why",
    age:18,
    eating(){
        console.log(this.name+" is eating");
    }
}
const p3: IPerson = obj
p3.eating() //why is eating

export { }